package org.mikrosopht.client;

import com.google.gwt.user.client.ui.Composite;

public class MovieListSorterController extends Composite implements MovieListSorterEventReceiver {

  private Runnable runOnUpdate;
  private MovieListSorter sorter;

  public MovieListSorterController(Runnable runOnUpdate) {
    this.runOnUpdate = runOnUpdate;
    this.sorter = new MovieListSorter(this);
    initWidget(sorter);
  }

  public void onClick(MovieListSorter.Button button) {
    runOnUpdate.run();
  }

  public MovieListSorter.Button getChecked() {
    return sorter.getChecked();
  }

  public void setChecked(MovieListSorter.Button button) {
    sorter.setChecked(button);
  }
}
